<!DOCTYPE html>
<html lang="zh-cn"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>百浪科技营销型官网 - 网站后台管理</title>
<link rel="stylesheet" href="/public/common/css/pintuer.css">
<link rel="stylesheet" href="/public/css/admin.css">
<link href="/public/ztree/css/zTreeStyle.css" rel="stylesheet" type="text/css" />
{$js}
<style>
body, html {
	overflow: hidden;
}
</style>
</head>
<body>
<div class="dux-head clearfix">
  <div class="dux-logo"> <a href="http://www.baiila.com" target="_blank"> <img src="/public/images/logo2.png" alt="后台管理系统" /> </a>
    <button class="button icon-navicon admin-nav-btn" data-target=".admin-nav"></button>
    <button class="button icon-navicon icon-ellipsis-v admin-menu-btn" data-target=".admin-menu"></button>
  </div>
  <div class="dux-nav">
    <ul class="nav  nav-navicon nav-inline admin-nav" id="nav">
    </ul>
    <ul class="nav  nav-navicon nav-menu nav-inline admin-nav nav-tool">
      <li> <a href="__ROOTURL__/" target="_blank" class="icon-home"></a></li>
      <li> <a href="__APP__/user" target="dux-iframe" class="icon-user"></a></li>
      <li> <a href="javascript:;" onclick="logout()" class="dux-logout bg-red icon-power-off"></a></li>
    </ul>
  </div>
</div>
<div class="dux-sidebar">
  
</div>
<div class="dux-admin">
  <div class="loading" id="content_loading" style="display:none"></div>
  <iframe id="dux-iframe" name="dux-iframe" class="dux-iframe" src="" frameborder="0"></iframe>
</div>
</body>
<script>
    //生成主菜单
    var data = {$menu_list};
    var topNav = '';
    for(var i in data){
        if(data[i]['menu'] != ''){
            topNav += '<li><a href="javascript:;"  url="'+data[i].url+'" class="icon-'+data[i].icon+'"> '+data[i].name+'</a></li>';
        }
    }
    $('#nav').html(topNav);
$(document).ready(function() {
	
	//主框架
	function frameheight() {
		var mainheight = $(window).height()-30;   
		$('.dux-sidebar').height(mainheight); 
	};
	frameheight();
	$(window).resize(frameheight);
	//绑定顶级菜单
	navload();
	
	//绑定超链接
	hrftload();
	
	//加载第一页面
	$.get($("#nav a:first").attr("url"), function(result){
		$(".dux-sidebar").html(result);
	});
	
	function frameheight() {
	var mainheight = $(window).height()-70;   
    $('.dux-sidebar').height(mainheight);
	};
	frameheight();
	$(window).resize(frameheight);
	navload();
	//绑定超链接
	hrftload();
})
    //绑定导航连接
  /*  $('#nav').on('click','a',function(){
        $('#nav-head').text($(this).text());
        var n = $(this).attr('data');
        var menu = data[n]['menu'];
        var menuHtml =  '';
        if(menu != ''){
            for(var i in menu){
				  menuHtml += '<li><a href="javascript:;" url="'+menu[i].url+'" class="icon-'+menu[i].icon+'"> '+menu[i].name+'</a></li>';
				  if(i==1&&menu[i].name=='内容管理'){
					  menuHtml += '<iframe src="__APP__/menu/content" onload="SetCwinHeight(this)" id="menu_fram" name="menu_fram" width="199" height="100%" frameborder="0"></iframe>';
				  }
            }
        }
        $('#menu').html(menuHtml);
		
        //设置样式
        $('#nav li').removeClass('active');
        $(this).parent('li').addClass('active');
        //打开菜单
        $('#menu a:first').click();
    });
		
    //绑定菜单连接
    $('#menu').on('click','a',function(){
        var url = $(this).attr('url');
        $('.dux-iframe').attr('src',url);
        //设置样式
        $('#menu li').removeClass('active');
        $(this).parent('li').addClass('active');
    });
    $('#nav a:first').click();*/


function navload() {
    $('#nav a').live("click",
    function() {
		url = $(this).attr("url");
		if (url !== '' && url !== '#') {
        $.get(url, function(result){
           $(".dux-sidebar").html(result);
        });
		$('#nav li').removeClass('active');
        $(this).parent('li').addClass('active');
		}
	return false;
	});
}

//绑定ajax超链接
function hrftload() {
    $('.load a,.url').live("click",
    function() {
        url = $(this).attr("href");
		len=url.substring(url.length-1,url.length);
        if (len == "" || len == '#') {
            return false;
        }
		ajaxload(url);
		 $('#menu li').removeClass('active');
        $(this).parent('li').addClass('active');

        return false;
    });
}
function ajaxload(url) {
    main_load(url);
}
//AJAX访问
function main_load(url){
	$('#content_loading').fadeIn(0);
	$("#dux-iframe").attr("src", url);
	$("#dux-iframe").load(function(){
	/*
    first = $("#nav ul a:first").attr("href");
    firstname = $("#nav ul a:first").text();
    url = $(obj).attr("href");
    urlname = $(obj).text();
    html = '<li> <a href="' + first + '">' + firstname + '</a> </li>';
    if (first !== url) {
        html += '<li> <a href="' + url + '">' + urlname + '</a> </li>';
    }
    $('#page_nav ul').html(html);
	*/
    $('#content_loading').fadeOut(1);
	});
}

//退出
function logout(){
	dialog({
		title: '退出确认',
		content: '是否退出网站管理系统？ ',
		button: [{
			name: '退出',
			callback: function() {
				$.ajax({
					type: 'POST',
					url: '__APP__/login/logout',
					data: {
						'out':'true' 
					},
					dataType: 'json',
					success: function(json) {
						window.location.reload();
					}

				});

			}
		},
		{
			name: '取消'
		}]
		
	});
}
$(function(){
	window.setTimeout(function(){
	$.getJSON('__APP__/upgrade/get_ver',
		function(json){
			if(json.status=="0"){
				return;
			}
			art.dialog.through({
				title: '更新提示！',
				content: json.message+' 3秒后自动关闭! ',
				lock: true,
				icon: 'succeed',
				button: [{
					name: '立即更新',
					callback: function() {
						window.location.href='__APP__/upgrade'
					},
					focus: true
				},
				{
					name: '稍后更新',
				}]
			});
			setTimeout(function() {
			//window.location.href=config.listurl
			}, 3000);
		}
	);
},1000);
	});
</script>
</html>